<template>
    <div class="page" style="">
      <div class="print_title" v-if="formData.lx == 2">框架合同变更详情 · 禾美环保</div>
      <div class="print_title" v-else>框架合同申请详情 · 禾美环保</div>
      <p class="title">基本信息</p>
      <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >单据编号:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.htbh }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >申请时间:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.createTime }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >申请人:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.proposer_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
  
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >申请部门:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.proposerDeptId_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>

        <a-col :span="12" v-if="formData.lx == 2">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >合同编号:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.caId_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >合同名称:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.htmc }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.htlx == 2">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >费用类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.feeType_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="this.formData.htlx == 2">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >是否采购类:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.isCategoryType_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <!-- <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >合同类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.htlx_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12" v-if="formData.lx == 2">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >变更类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.bglx_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <!-- <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >项目名称:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.xmmc_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12" v-if="formData.isCategoryType == '1'">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >采购类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.provisionType_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.provisionType == 1">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.calibrationId_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.provisionType == 2">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.purchaseApplyId_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.provisionType == 3">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.invitationId_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" style="display:none">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >项目编号:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.xmbh }}</p>
            </a-col>
          </a-row>
        </a-col>
  
        <!-- <a-col :span="12" v-if="formData.htlx == 2 && formData.feeType=='2'">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >费用所属团队:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.jytd_dictText?formData.jytd_dictText:formData.jytd }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >合同类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.htlx_dictText}}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >经营团队:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.jytd_dictText?formData.jytd_dictText:formData.jytd }}</p>
            </a-col>
          </a-row>
        </a-col>
  
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >业绩归属年度:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.yjgsnd_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >签订单位:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.qddw_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >项目承接人:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.xmcjr_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >业主单位:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.yzdw_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >联系人:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.lxr_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >联系方式:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.lxfs }}</p>
            </a-col>
          </a-row>
        </a-col>
  
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >签订日期:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.qdrq }}</p>
            </a-col>
          </a-row>
        </a-col>
        <!-- <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >履约保证金(元):</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.bail }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <!-- <a-col :span="12" v-if="formData.htlx == 1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >分配方式:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.distributionMethod_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >是否用印:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.sfyz_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <!-- <a-col :span="12" v-if="formData.sfyz == '0'">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >无正式合同:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.noFormalContract_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12" v-if="formData.sfyz && formData.sfyz ==1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >用印类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.signSealWay_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.sfyz && formData.sfyz ==1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >印章类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.yzlx_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.sfyz && formData.sfyz ==1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >用印份数:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.yyfs }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >是否存档:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.sfcd_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.sfcd==='1'">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >合同存档份数:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.cdfs }}</p>
            </a-col>
          </a-row>
        </a-col>
  
        <!-- <a-col :span="12" v-if="formData.htlx !='1'">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >关联收款合同:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.glskht_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <!-- <a-col :span="12" v-if="formData.glskht && formData.glskht == 1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >收款合同名称:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.skhtmc_dictText }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <!-- <a-col :span="12" v-if="formData.glskht && formData.glskht == 1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >收款合同额(元):</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.skhte }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <!-- <a-col :span="12" v-if="formData.glskht && formData.glskht == 1">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >收款合同额大写:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.skhtedx }}</p>
            </a-col>
          </a-row>
        </a-col> -->
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >本次合同额(元):</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.bchte }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >本次合同额大写:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.bchtedx }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >服务期限:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.fwqx && formData.fwqxEnd? formData.fwqx + '~' + formData.fwqxEnd:'' }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="24">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >备注:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.bz }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="24">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >邮寄信息:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.yjxx }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="24" v-if="formData.lx == 2">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >变更说明:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.contractChangeReason }}</p>
            </a-col>
          </a-row>
        </a-col>
      </a-row>
      <!-- 附件信息 -->
      <FileInfor :purchaseFile="purchaseFile" title="合同原件" v-if="purchaseFile && purchaseFile.length && formData.sfyz ==0"></FileInfor>
  
      <a-row type="flex" justify="center" style="margin-top: 18px" v-if="dataSource4 && dataSource4.length">
        <a-col>
          <p class="title_table">{{ formData.htlx == 2?'受托方(合同乙方)信息':'委托方(合同甲方)信息' }}</p>
        </a-col>
        <a-col :span="24">
          <a-table
            :columns="columns4"
            :data-source="dataSource4"
            bordered
            :pagination="false"
            size="small"
            :rowClassName="tableRowClass"></a-table>
        </a-col>
      </a-row>
      <a-row type="flex" justify="center" style="margin-top: 18px" v-if="dataSource3 && dataSource3.length">
        <a-col>
          <p class="title_table">{{ formData.htlx == 2?'委托方(合同甲方)信息':'受托方(合同乙方)信息' }}</p>
        </a-col>
        <a-col :span="24">
          <a-table
            :columns="columns3"
            :data-source="dataSource3"
            bordered
            :pagination="false"
            size="small"
            :rowClassName="tableRowClass"></a-table>
        </a-col>
      </a-row>
      <a-row type="flex" justify="center" style="margin-top: 18px" v-if="dataSource && dataSource.length">
        <a-col>
          <p class="title_table">任务信息</p>
        </a-col>
        <a-col :span="24">
          <a-table
            :columns="columns"
            :data-source="dataSource"
            bordered
            :pagination="false"
            size="small"
            :rowClassName="tableRowClass"></a-table>
        </a-col>
      </a-row>
      <a-row type="flex" justify="center" style="margin-top: 18px" v-if="dataSource1 && dataSource1.length">
        <a-col>
          <p class="title_table">收付款计划</p>
        </a-col>
        <a-col :span="24" class="content" v-if="formData.lx ==2">
          <a-row>
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >是否变更款项信息:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.sfbgkxxx_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="24">
          <a-table
            :columns="columns1"
            :data-source="dataSource1"
            bordered
            :pagination="false"
            size="small"
            :rowClassName="tableRowClass"></a-table>
        </a-col>
      </a-row>
      <!-- 附件信息 -->
      <FileInfor :purchaseFile="signFile" title="用印文件" v-if="signFile && signFile.length && formData.sfyz ==1"></FileInfor>
      <FileInfor :purchaseFile="businessFile" title="相关附件" v-if="businessFile && businessFile.length"></FileInfor>
  
      <!-- 流程详情 -->
      <ProcessInfor v-if="formData.bpmStatus !== '1'" :dataHistorySource="dataHistorySource"></ProcessInfor>
    </div>
  </template>
  <script>
  import { getAction } from '@/api/manage'
  import FileInfor from '@/components/print/FileInfor.vue' // 审批历史流程列表组件
  import ProcessInfor from '@/components/print/ProcessInfor.vue' // 审批历史流程列表组件
  import address from '@/components/AddressChoice/address.js'
  import { filterMultiDictText, initDictOptions, filterDictTextByCache } from '@/components/dict/JDictSelectUtil'
  export default {
      props: {
          formData: {
              type: Object,
              default: () => {},
              required: true
      },
          formDataHistory: {
              type: Object,
              default: () => {},
              required: true
      }
      },
    components: {
      FileInfor,
      ProcessInfor
    },
    data() {
      return {
        address,
        filterMultiDictText,
        dictOptions: {},
        dataSource: [], // 物料列表
        columns: [
                  {
                      title: '序号',
                      dataIndex: '',
                      key: 'rowIndex',
                      width: 45,
                      align: 'center',
                      customRender: function (t, r, index) {
                          return parseInt(index) + 1;
                      }
                  },
                  {
            title: '业务编码5',
            align: 'center',
            dataIndex: 'ywfl'
          },
          {
            title: '业务名称',
            align: 'center',
            dataIndex: 'ywmc'
          },
          {
            title: '合同占比(%)',
            align: 'center',
            dataIndex: 'htzb'
          },
          {
            title: '分配合同额（元）',
            align: 'center',
            dataIndex: 'fphte'
          },
          {
            title: '切割合同额（元）',
            align: 'center',
            dataIndex: 'cutContractAmount'
          },
          {
            title: '生产团队',
            align: 'center',
            dataIndex: 'sctd_dictText'
          },
          {
            title: '团队负责人',
            align: 'center',
            dataIndex: 'tdfzr_dictText'
          }
              ],
  
        columns3: [
        {
                      title: '序号',
                      dataIndex: '',
                      key: 'rowIndex',
                      width: 45,
                      align: 'center',
                      customRender: function (t, r, index) {
                          return parseInt(index) + 1;
                      }
                  },
          {
            title: '名称',
            align: 'center',
            dataIndex: 'gsdaId_dictText'
          }
        ],
        columns4: [
          {
                      title: '序号',
                      dataIndex: '',
                      key: 'rowIndex',
                      width: 45,
                      align: 'center',
                      customRender: function (t, r, index) {
                          return parseInt(index) + 1;
                      }
                  },
          {
            title: '名称',
            align: 'center',
            dataIndex: 'khdaId_dictText'
          }
        ],
        dataSource3: [], // 公司信息
        dataSource4: [], // 客户信息
  
        dataSource1: [], // 收付款计划
        columns1: [
        {
            title: '款项名称',
            align: 'center',
            dataIndex: 'kxmc'
          },
          {
            title: '金额(元)',
            align: 'center',
            dataIndex: 'je'
          },
          {
            // 3.收付款计划列表中的款项时间改为预计款项时间，为必填
            title: '预计款项日期',
            align: 'center',
            dataIndex: 'kxrq'
          },
          {
            // 3.收付款计划列表中的款项时间改为预计款项时间，为必填
            title: '款项节点说明',
            align: 'center',
            dataIndex: 'kxjdsm'
          },
          {
            title: '款项关联任务',
            align: 'center',
            dataIndex: 'taskId_dictText'
          },
          {
            title: '应收状态',
            align: 'center',
            dataIndex: 'collectMoneyStatus'
          },
          // {
          //   title: '款项节点说明',
          //   align: 'center',
          //   dataIndex: 'kxjdsm'
          // }
        ],
  
              dataHistorySource: [], // 流程列表
              url: {
                  queryEntrustList: '/api/erp/omc/contractmanager/erpOmcContractManagerEntrust/listAll',
          queryTrusteeList: '/api/erp/omc/contractmanager/erpOmcContractManagerTrustee/listAll',
          queryPlanList: '/api/erp/omc/contractmanager/erpOmcContractManagerPlan/listAll',
          queryClassList: '/api/erp/omc/contractmanager/erpOmcContractManagerClass/listAll',
                  historyList: '/api/erpmng/act/task/processHistoryList' // 流程历史跟踪接口
              },
              purchaseFile: [], // 附件
        businessFile: [],
        signFile: []
      };
    },
      watch: {
          formData: {
              handler (val) {
                  if (val) {
            // 判断是委托方还是收款方
            console.log('------------val.htlx============', val.htlx)
            this.changeTitle(val.htlx)
                      this.list()
                      this.getHistoryList()
            this.initDictConfig() // 字典值
                      if (val.masterCopy) {
                          this.purchaseFile = val.masterCopy.split(',')
                      }
                      if (val.xgfj) {
                          this.businessFile = val.xgfj.split(',')
                      }
                      if (val.signFile) {
                          this.signFile = val.signFile.split(',')
                      }
                  }
              },
              immediate: true
          },
          formDataHistory: {
              handler (val) {
                  if (val) {
                      this.getHistoryList()
                  }
              },
              immediate: true
          }
      },
      methods: {
          // 获取列表
          getHistoryList() {
              var params = { processInstanceId: this.formDataHistory.procInsId };// 查询条件
              getAction(this.url.historyList, params).then(res => {
                  if (res.success) {
                      this.dataHistorySource = res.result.records || res.result
                  }
              })
          },
  
      initDictConfig() {
        initDictOptions('erp_employee_file,name,id').then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, 'tenderPerson', res.result)
          }
        })
      },
  
          list () {
              if (!this.formData.id) {
                  return false
              }
        // 收款计划
        getAction(this.url.queryPlanList, { mainId: this.formData.id }).then((res) => {
          if (res.success) {
            // res.result数组中的planTaskList数组中拼接categoryName形成款项关联任务
              res.result.map((value, index) => {
                res.result[index].taskId_dictText = '' // 首先款项关联任务字段默认为空
                // 遍历planTaskList数组赋值给taskId_dictText
                res.result[index].taskId_dictText = value.planTaskList && value.planTaskList.length ? (value.planTaskList.map((obj)=>{return obj.categoryName }).join(",")):'';
              })
            this.dataSource1 = res.result || res.result.records
          }
        })
        // 任务信息
        getAction(this.url.queryClassList, { mainId: this.formData.id }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records || res.result
            this.dataSource.forEach((item, index) => {
              if (this.formData.bchte) {
                if (this.formData.distributionMethod == 1) {
                  // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
                  // item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.formData.bchte)).toFixed(2)
                  let amount = this.formData.bchte * item.htzb / 100
                  item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
                } else {
                  // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
                  let rate = item.fphte / this.formData.bchte * 100
                  item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
                  // item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.formData.bchte)*100).toFixed(2)
                }
              } else {
                if (this.formData.distributionMethod == 1) {
                  // 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
                  item.fphte = 0
                } else {
                  // 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
                  item.htzb = 0
                }
              }
            })
          }
        })
        
        // 公司信息
        getAction(this.url.queryTrusteeList, { mainId: this.formData.id }).then((res) => {
            if (res.success) {
              this.dataSource3 = res.result.records || res.result
            }
          })
  
          // 客户信息
          getAction(this.url.queryEntrustList, { mainId: this.formData.id }).then((res) => {
            if (res.success) {
              this.dataSource4 = res.result.records || res.result
            }
          })
          },
  
      // 判断委托方还是受托方
      changeTitle (args) {
        if (args == '1') { // 收款合同类型时
           this.firstTitle = '委托方(合同甲方)信息'
           this.secondTitle = '受托方(合同乙方)信息'
            // 修改列表表头
            this.$set(this, 'columns4', [
              {
                title: '序号',
                dataIndex: '',
                key: 'rowIndex',
                width: 45,
                align: 'center',
                customRender: function (t, r, index) {
                  return parseInt(index) + 1;
                }
              },
              {
                title: '名称',
                align: 'center',
                dataIndex: 'khdaId_dictText'
              },
              // {
              //   title: '是否为付款单位',
              //   align: 'center',
              //   dataIndex: 'isFk_dictText'
              // },
              {
                title: '对方是否电子签章',
                align: 'center',
                dataIndex: 'isSignSeal',
                customRender: (text) => {
                  if (!text) {
                    return ''
                  } else {
                    return filterDictTextByCache('yes_no', text)
                  }
                }
              },
              {
                title: '对方盖章人',
                align: 'center',
                dataIndex: 'psnName'
              },
              {
                title: '联系方式',
                align: 'center',
                dataIndex: 'psnMobile'
              }
              ])
              this.$set(this, 'columns3', [
              {
                title: '序号',
                dataIndex: '',
                key: 'rowIndex',
                width: 45,
                align: 'center',
                customRender: function (t, r, index) {
                  return parseInt(index) + 1;
                }
              },
              {
                title: '名称',
                align: 'center',
                dataIndex: 'gsdaId_dictText'
              },
              // {
              //   title: '是否为收款单位',
              //   align: 'center',
              //   dataIndex: 'isSk_dictText'
              // },
              {
                title: '我方经办人',
                align: 'center',
                dataIndex: 'psnName'
              },
              {
                title: '联系方式',
                align: 'center',
                dataIndex: 'psnMobile'
              }
            ])
         } else { // 付款合同类型时
           this.firstTitle = '受托方(合同乙方)信息'
           this.secondTitle = '委托方(合同甲方)信息'
           // 修改列表表头
            this.$set(this, 'columns4', [
              {
                title: '序号',
                dataIndex: '',
                key: 'rowIndex',
                width: 45,
                align: 'center',
                customRender: function (t, r, index) {
                  return parseInt(index) + 1;
                }
              },
              {
                title: '名称',
                align: 'center',
                dataIndex: 'khdaId_dictText'
              },
              // {
              //   title: '是否为收款单位',
              //   align: 'center',
              //   dataIndex: 'isSk',
              //   customRender: (text) => {
              //     if (!text) {
              //       return ''
              //     } else {
              //       return filterDictTextByCache('yes_no', text)
              //     }
              //   }
              // },
              {
                title: '对方是否电子签章',
                align: 'center',
                dataIndex: 'isSignSeal',
                customRender: (text) => {
                  if (!text) {
                    return ''
                  } else {
                    return filterDictTextByCache('yes_no', text)
                  }
                }
              },
              {
                title: '对方盖章人',
                align: 'center',
                dataIndex: 'psnName'
              },
              {
                title: '联系方式',
                align: 'center',
                dataIndex: 'psnMobile'
              }
              ])
              this.$set(this, 'columns3', [
              {
                title: '序号',
                dataIndex: '',
                key: 'rowIndex',
                width: 45,
                align: 'center',
                customRender: function (t, r, index) {
                  return parseInt(index) + 1;
                }
              },
              {
                title: '名称',
                align: 'center',
                dataIndex: 'gsdaId_dictText'
              },
              // {
              //   title: '是否为付款单位',
              //   align: 'center',
              //   dataIndex: 'isFk',
              //   customRender: (text) => {
              //     if (!text) {
              //       return ''
              //     } else {
              //       return filterDictTextByCache('yes_no', text)
              //     }
              //   }
              // },
              {
                title: '我方经办人',
                align: 'center',
                dataIndex: 'psnName'
              },
              {
                title: '联系方式',
                align: 'center',
                dataIndex: 'psnMobile'
              }
            ])
         }
      },
  
          tableRowClass(record, index) {
              console.log('record, index', record, index)
              if (index == 0) {
                  return 'rowClass';
              }
        return ''
      },
  
      getAddress (text) {
        if (!text) {
          return false
        }
        var areaList = text.split(',')
        var areaText = ''
        this.address.map(value => {
          if (areaList[0] && areaList[0] == value.code) {
            areaText = areaText + value.name + '/'
            if (value && value.children && value.children.length) {
              value.children.map(val => {
                if (areaList[1] && areaList[1] == val.code) {
                  areaText = areaText + val.name + '/'
  
                  if (val && val.children && val.children.length) {
                    val.children.map(va => {
                      if (areaList[2] && areaList[2] == va.code) {
                        areaText = areaText + va.name
                      }
                    })
                  }
                }
              })
            }
          }
        })
        return areaText
      }
      }
  };
  </script>
  <style lang="less" scoped>
  .page{
      background: #ffffff;
      padding: 19px 28px 0 28px;
      width: 750px;
      .print_title{
          font-size: 15px;
          font-family: Alibaba PuHuiTi 2.0;
          font-weight: normal;
          color: #000000;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-bottom: 9px;
      }
      .title {
          background: #EEEEEE;
          font-size: 13px;
          font-family: Alibaba PuHuiTi 2.0;
          font-weight: normal;
          color: #000000;
          padding: 11px 9px;
      }
      .title_table{
          font-size: 13px;
          font-family: Alibaba PuHuiTi 2.0;
          font-weight: normal;
          color: #000000;
      }
  }
  /deep/ .rowClass{
      font-size: 10px;
      font-family: Alibaba PuHuiTi 2.0;
      font-weight: normal;
      color: #000000;
  }
  /deep/ .ant-table-thead th{
      font-size: 10px;
      font-family: Alibaba PuHuiTi 2.0;
      font-weight: normal;
      color: #000000;
  }
  /deep/ .ant-table-thead tr{
      background: #EEEEEE;
  }
  /deep/ .ant-table-small > .ant-table-content > .ant-table-body {
      margin: 0 0px;
  }
  /deep/ .ant-table-body tr {
      font-size: 10px;
      font-family: Alibaba PuHuiTi 2.0;
      font-weight: normal;
      color: #000000;
  }
  /deep/ .ant-table-body tr td {
      word-wrap:break-word;
      word-break:break-all;
    }
  .content {
          font-size: 13px;
      }
  </style>
  